'''
Created on Aug 25, 2011

@author: david
'''

from pspy.gae.actiondomain import PspyAction

class Process(PspyAction):
    """
    Default Action 
    spawns index.gen
    """
    def execute(self):
        from app.Ranger.agents import AppAgent
        import logging 
        
        nxtPage = "/Ranger/Results.gen"
        req = self.request

        # harvest request params
        vin = req.getParameter("vin")
        pin = req.getParameter("pin")
        did = req.getParameter("did")
        
        logging.info("~~ Processing %s %s %s" % (pin,vin,did))
        
        # agent processing
        data = AppAgent().procRequest(vin, pin, did)
        
        # marshal up the results
        req.setAttribute("descr",data[0])
        req.setAttribute("pymts",data[2])
        
        # setup dynamic page
        req.setResponsePage(nxtPage)
        
        # all done
        return req.getResponse()
    
    def sess_check(self):
        return True